package com.imau.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class ServletListener implements ServletContextListener {

    //监听web创建，执行一次
    @Override
    public void contextInitialized(ServletContextEvent sce) {

        //初始化资源，监听web创建
        System.out.println("contextInitialized....");
//        ServletContext servletContext = sce.getServletContext();
        // servletContext.setAttribute();
    }

    //停止应用，执行一次
    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("contextDestroyed....");
    }
}